$("body").delegate(".back_evaluate","click",function (){
    $("#service-list").removeClass("gray_bg");
    $(".evaluate").hide();
    var type=$('.icon_span').attr('evaluate_type');
    var orderid=$('.icon_span').attr('orderid');
    $.ajax({
        type: "POST",
        url: webConfig.url+"/Home/Index/uploadEvaluate",
        data: {type:type,orderid:orderid,desc:'',score:"5"},
        dataType: "JSONP",
        crossDomain: true,
        success:function(data){
        }
    })
});
var text_arr=["非常不满意，各方面都很差","不满意，比较差","一般，还需改善","比较满意，任可改善","非常满意，无可挑剔"];
$("body").delegate(".icon_span span","click",function (){
    var index=$(this).index();
    for(var i=0;i<=4;i++){
        if($("#evaluate_score"+i).hasClass("icon-shiwujiaoxing")){
            $("#evaluate_score"+i).addClass("icon-kongwujiaoxing").removeClass("icon-shiwujiaoxing");
        }
    }
    for(var i=0;i<=index;i++){
        if($("#evaluate_score"+i).hasClass("icon-kongwujiaoxing")){
            $("#evaluate_score"+i).addClass("icon-shiwujiaoxing").removeClass("icon-kongwujiaoxing"); 
        }
    }
    $(".no_or_ok P").html(text_arr[index]);
    $('.icon_span').attr('select_score',index+1);
});
$("body").delegate(".upload_evaluate","click",function (){
    var desc=$('.evaluate_desc').val();
    var score=$('.icon_span').attr('select_score');
    var type=$('.icon_span').attr('evaluate_type');
    var orderid=$('.icon_span').attr('orderid');
    $.ajax({
        type: "POST",
        url: webConfig.url+"/Home/Index/uploadEvaluate",
        data: {type:type,orderid:orderid,desc:desc,score:score},
        dataType: "JSONP",
        crossDomain: true,
        success:function(data){
            mui.toast('评价成功')
            $("#service-list").removeClass("gray_bg");
            $(".evaluate").hide();
        }
    })
})
function show_evaluate(evaluate_type,orderid){
    var mobilephone=getLoginPhone();
    if(mobilephone){ 
        $.ajax({
            type: "POST",
            url: webConfig.url+"/Home/Index/checkEvaluate",
            data: {type:evaluate_type,orderid:orderid},
            dataType: "JSONP",
            crossDomain: true,
            success:function(data){
                if(data=="0"){
                    $("#service-list").toggleClass("gray_bg");
                    $(".evaluate").show();
                    for(var i=0;i<=4;i++){
                        if($("#evaluate_score"+i).hasClass("icon-kongwujiaoxing")){
                            $("#evaluate_score"+i).addClass("icon-shiwujiaoxing").removeClass("icon-kongwujiaoxing"); 
                        }
                    }
                    $(".no_or_ok P").html(text_arr[4]);
                    $('.icon_span').attr('select_score',"5");
                    $('.icon_span').attr('evaluate_type',evaluate_type);
                    $('.icon_span').attr('orderid',orderid);
                    if(evaluate_type==1){
                        $('.icon_wjx h5').text("销售顾问");
                    }else{
                        $('.icon_wjx h5').text("手续办理员");
                    }
                }
                
                
            }
        })
    }
}


